import request from '@/config/axios'

// 协议配置 VO
export interface AgreementVO {
  id: number // 主键
  content: string // 内容
  type: number // 协议类型 1注册协议 2供求协议
}

// 协议配置 API
export const AgreementApi = {
  // 查询协议配置分页
  getAgreementPage: async (params: any) => {
    return await request.get({ url: `/wine/agreement/page`, params })
  },

  // 查询协议配置详情
  getAgreement: async (id: number) => {
    return await request.get({ url: `/wine/agreement/get?id=` + id })
  },

  // 新增协议配置
  createAgreement: async (data: AgreementVO) => {
    return await request.post({ url: `/wine/agreement/create`, data })
  },

  // 修改协议配置
  updateAgreement: async (data: AgreementVO) => {
    return await request.put({ url: `/wine/agreement/update`, data })
  },

  // 删除协议配置
  deleteAgreement: async (id: number) => {
    return await request.delete({ url: `/wine/agreement/delete?id=` + id })
  },

  // 导出协议配置 Excel
  exportAgreement: async (params) => {
    return await request.download({ url: `/wine/agreement/export-excel`, params })
  }
}